let mysql = require("mysql")

const conn = mysql.createConnection({

    host: "localhost",//127.0.0.1 本地ip地址

    user: "root",

    password: "123",

    database: "login"

});
conn.connect(); 
console.log('连接成功')

let sql = "select * from user"  //sql语句
conn.query(sql,(err,result)=>{
        if(err){
            console.log(err);
            return;
        }
        console.log(result);
});



conn.end();


// export default {
//     test: function() {
//       alert('测试一下数据库接口')
//     }
//   }